//
//  ZYCustomTextField.m
//  YiLin
//
//  Created by Zyark on 2019/1/6.
//  Copyright © 2019 Zyark. All rights reserved.
//

#import "ZYCustomTextField.h"

@interface ZYCustomTextField()
@property(nonatomic,strong) UILabel *leftLabel;
@property(nonatomic,strong) UITextField *textField;
@end

@implementation ZYCustomTextField

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self setup];
    }
    return self;
}

-(void)setup{
    _leftLabel = [[UILabel alloc] init];
    _leftLabel.size = CGSizeMake(30, 15);
    _leftLabel.font = [UIFont systemFontOfSize:14];
    _leftLabel.textColor = RGBA(51, 51, 51, 1);
    _leftLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:_leftLabel];
    _leftLabel.centerY = self.height / 2;
    _leftLabel.left = 15;
    
    _textField = [[UITextField alloc] init];
    _textField.backgroundColor = RGBA(248, 248, 248, 1);
    _textField.size = CGSizeMake(self.width - _leftLabel.right - 25, 25);
    [self addSubview:_textField];
    _textField.centerY = _leftLabel.centerY;
    _textField.left = _leftLabel.right + 10;
    _textField.keyboardType = UIKeyboardTypeDecimalPad;
    
}

-(void)setTitle:(NSString *)title{
    _title = title;
    _leftLabel.text = title;
}

-(NSString *)getTextFieldValue{
    return _textField.text;
}

-(void)setTextFieldValue:(NSString *)value{
    _textField.text = value;
}
@end
